From cc7e598c8ce21c2c42b2f0fac54e3e35288e72ff Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 19 Sep 2005 18:40:41 +0000 Subject: [PATCH] BablFishPath touchups --- ChangeLog | 18 +++ babl/babl-conversion.c | 2 +- babl/babl-fish-path.c | 2 + babl/babl-internal.c | 2 + docs/index-static.html.in | 2 + extensions/gggl.c | 2 + tests/babl_fish_path_dhtml.c | 208 +++++++++++++++-------------------- 7 files changed, 115 insertions(+), 121 deletions(-) diff --git a/ChangeLog b/ChangeLog index c421930..0c9857c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2005-09-19 Øyvind Kolås + + BablFishPath touchups. + + * babl/babl-conversion.c: cost = cost * 10 + 1, makes the overhead + of actually running a conversion 1. Removed stupid long pats from + created conversions. + * babl/babl-fish-path.c: (chain_gen_each): Ensure the chain doesn't + take us through larger loss than allowed. + * babl/babl-internal.c: (babl_extension_post_load): do not + autogenerate formats. + * docs/index-static.html.in: updating documentation. + * tests/babl_fish_path_dhtml.c: (table_destination_each), + (table_source_each), (main): recoded to use CSS tricks instead of + javascript, reduced generated file size by 50%; + * extensions/gggl.c: (conv_labF_xyzF), (conv_xyzF_labF): added missing + return value. + 2005-09-19 Øyvind Kolås * extensions/gggl.c: Added the bulk of gggl based conversions as an diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c index 976f437..593110c 100644 --- a/babl/babl-conversion.c +++ b/babl/babl-conversion.c @@ -522,7 +522,7 @@ babl_conversion_error (BablConversion *conversion) babl_free (test); conversion->error = error; - conversion->cost = ticks_end-ticks_start; + conversion->cost = (ticks_end-ticks_start)*10+1; return error; } diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c index 491ac6f..a7e76cb 100644 --- a/babl/babl-fish-path.c +++ b/babl/babl-fish-path.c @@ -198,6 +198,8 @@ chain_gen_each (Babl *babl, temp_loss = analytic_loss; if (error <= (1.0 + BABL_LEGAL_ERROR) /* we're legal */ && + (temp_loss >= format_analytic_loss (c->from, c->to)) && + /* better than the existing best candidate */ ( temp_loss < *c->best_loss || diff --git a/babl/babl-internal.c b/babl/babl-internal.c index aacac8a..555f672 100644 --- a/babl/babl-internal.c +++ b/babl/babl-internal.c @@ -160,6 +160,8 @@ babl_extension_post_load (void) { babl_conversion_each (each_conversion, NULL); babl_format_each (each_format, NULL); + return; babl_model_each (gen_formats_for_model, NULL); + babl_format_each (each_format, NULL); } diff --git a/docs/index-static.html.in b/docs/index-static.html.in index 796632d..d776c15 100644 --- a/docs/index-static.html.in +++ b/docs/index-static.html.in @@ -282,6 +282,8 @@

TODO

    +
  • Validate that BablFishPath is actually faster than the + BablFishReference it is a replacement for.
  • Compile-time instead of runtime profiling / storae of profiling and loss data.. (The speed of conversions is bound to 'wobble', according to architecture, compiler flags, diff --git a/extensions/gggl.c b/extensions/gggl.c index a598de1..070d4cc 100644 --- a/extensions/gggl.c +++ b/extensions/gggl.c @@ -1624,6 +1624,7 @@ conv_labF_xyzF (unsigned char *src, unsigned char *dst, long samples) dst_f += 3; src_f += 3; } + return samples; } static INLINE long @@ -1667,6 +1668,7 @@ conv_xyzF_labF (unsigned char *src, unsigned char *dst, long samples) dst_f += 3; src_f += 3; } + return samples; } /******* end of cpercep lift out **/ diff --git a/tests/babl_fish_path_dhtml.c b/tests/babl_fish_path_dhtml.c index 7694914..ddd384f 100644 --- a/tests/babl_fish_path_dhtml.c +++ b/tests/babl_fish_path_dhtml.c @@ -44,23 +44,50 @@ table_destination_each (Babl *babl, if (temp) { - printf ("%s", - temp, temp, utf8_bar[temp->fish_path.conversions]); + printf ("%s", + utf8_bar[temp->fish_path.conversions]); total_length += temp->fish_path.conversions; total_cost += temp->fish_path.cost; + + { + int i; + printf ("
    "); + printf ("

    path %s to %s

    ", source->instance.name, destination->instance.name); + printf ("\n"); + + printf (""); + printf (""); + printf (""); + printf (""); + + for (i=0; i< temp->fish_path.conversions; i++) + { + printf (""); + printf ("", BABL(temp->fish_path.conversion[i])->instance.name); + printf ("", BABL(temp->fish_path.conversion[i])->conversion.cost); + printf (""); + } + + printf (""); + printf (""); + printf ("", temp->fish_path.cost); + printf (""); + printf ("
    conversioncost
    %s%i
    total%3.0f
    \n"); + printf ("
    \n"); + } + printf ("
    "); ok ++; total ++; } else { - printf ("%s", - source, destination, - source, destination, - " "); + printf ("%s", " "); + { + printf ("
    "); + printf ("

    Reference %s to %s

    ", source->instance.name, destination->instance.name); + printf ("
    \n"); + } + printf ("
    "); } } return 0; @@ -101,96 +128,37 @@ table_source_each (Babl *babl, } printf (""); - printf ("%s", - babl, babl, expanded_name); + printf ("%s", expanded_name); + { + int i; + + printf ("
    ", babl); + printf ("

    %s

    ", babl->instance.name); + + printf ("
    "); + printf ("
    bytes/pixel
    %i
    ", babl->format.bytes_per_pixel); + printf ("
    model
    %s
    ", BABL(babl->format.model)->instance.name ); + printf ("
    loss
    %f
    ", babl->format.loss ); + printf ("
    components
    "); + + for (i=0; i< babl->format.components; i++) + { + printf ("", + BABL(babl->format.type[i])->instance.name, + BABL(babl->format.component[i])->instance.name ); + } + printf ("
    %s%s
    "); + + printf ("
    \n"); + } + + printf ("
    "); babl_format_each (table_destination_each, babl); printf ("\n"); source_no++; return 0; } - - -static int -detail_destination_each (Babl *babl, - void *userdata) -{ - Babl *source = userdata; - Babl *destination = babl; - - Babl *temp = babl_fish_path (source, destination); - - if (temp) - { - int i; - printf ("\n"); - } - else - { - printf ("\n"); - } - return 0; -} - -static int -detail_source_each (Babl *babl, - void *userdata) -{ - babl_format_each (detail_destination_each, babl); - return 0; -} - -static int -format_each (Babl *babl, - void *userdata) -{ - int i; - - printf ("\n"); - return 0; -} - - int main (void) { babl_init (); @@ -218,23 +186,23 @@ int main (void) " padding: 0;" " margin : 0;" "}" - " .cell>a {" + ".cell>a {" " text-decoration: none;" " color: black;" " cursor: help;" "}" - " .detail {" + "div.tooltip {" " border: 0.2em solid black;" " padding-top: 1em;" " padding-right: 2em;" + " display: none;" " padding-left: 2em;" " padding-bottom: 3em;" " background-color: white;" - "}" - "#tooltip {" - " position: fixed;" - " bottom: 0;" - " right : 0;" + " background-repeat: no-repeat;" + " background-image: url(graphics/babl-48x48.png);" + " background-position: bottom right;" + " color: black;" "}" " .cell>a:hover {" " background-color: black;" @@ -257,6 +225,13 @@ int main (void) " color: white;" " }" + "a:hover>div.tooltip {" + " display: block;" + " position: fixed;" + " bottom: 0;" + " right: 0;" + "}" + "td.component {" " background-color: #060;" " padding-left: 0.5em;" @@ -277,26 +252,25 @@ int main (void) " color: white;" " border: 1px solid white;" "}" + ".g {" + " color: gray;" + "}" + ".r {" + " text-align: right;" + "}" "" "" @@ -306,18 +280,12 @@ int main (void) printf ("

    BablFishPath introspection

    "); printf ("

    The table below represents many of the possible conversions available through babl, (the selection of formats includes all formats that shortcut conversions have been registered for.)

    "); - printf ("

    Hover your mouse over a formats name, or a non blank cell on the horizontal line to see further information

    "); + printf ("

    Hover your mouse over a formats name, or a non blank cell on the horizontal line to see further information, both rows and colums represent pixel formats, but only the vertical axis has labels.

    "); - printf ("
    /babl"); printf ( "\n"); babl_format_each (table_source_each, NULL); printf ("
    "); - printf ("
    "); - babl_format_each (detail_source_each, NULL); - babl_format_each (format_each, NULL); - printf ("
    "); - printf ("
    \n"); printf ("\n"); -- 2.30.2